<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    //b is not defined
    //var没有作用域的概念 let有局部作用域
    {
        var a=111;
        let b=222;
    }
    console.log(a);
    console.log(b);

    //Identifier 'b' has already been declared
    //var可以重复声明 let不能重复声明
    var a=111;
    var a=111;
    let b=222;
    let b=222;
    console.log(a);
    console.log(b);

    //Cannot access 'b' before initialization
    //let必须先声明后使用 var会自动变量提升
    console.log(a);
    var a=111;
    console.log(b);
    let b=222;

    //Assignment to constant variable.
    //const修饰的是常量，不能被修改
    const a=111;
    a=222;

</script>
</html>